package com.itheima.string.Test1;
//1.定义标准类
public class Worker {
    //2.私有化成员变量
    private String name;
    private int year;
    //3.无参数构造
    public Worker() {
    }
    //4.有参数构造
    public Worker(String name, int year) {
        this.name = name;
        this.year = year;
    }
    //5.setting,getting来一套
    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public int getYear() {
        return year;
    }

    public void setYear(int year) {
        this.year = year;
    }
    //6.定义方法
    public  void method(){
        System.out.println("该工人对象的属性信息如下：");
        System.out.println("姓名:" + name);
        System.out.println("工龄:" + year);
    }
}
